﻿using Candy.Infrastructure;
using Candy.Model;
using Candy.Web.Data;
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Candy.ViewModel
{
    public class PhylogenyEditViewModel : EntityEditViewModel<PhylogenyDto>
    {

        INavigationService _navigationService ;
        public PhylogenyEditViewModel(IDataService dataService, INavigationService navigationService, PhylogenyDto dto)
            : base(dataService, dto, dataService.Phylogenies)
        {
            _navigationService = navigationService;
            if (!IsInDesignMode)
            {
                this.Canceled += PhylogenyEditViewModel_Canceled;
                this.Saved += PhylogenyEditViewModel_Saved;
            }
        }

        void PhylogenyEditViewModel_Saved(object sender, EventArgs e)
        {
            _navigationService.ClosePhylogenyEditor();
        }

        void PhylogenyEditViewModel_Canceled(object sender, EventArgs e)
        {
            _navigationService.ClosePhylogenyEditor();
        }
    }
}
